<?php

class Default_Model_Validator
{
	static $firstNameExp	= '/^[a-zÀ-ÿ -]{2,30}$/i';
	static $lastNameExp		= '/^[a-zÀ-ÿ -]{2,75}$/i';
	static $usernameExp		= '/^[a-zÀ-ÿ0-9_]{3,20}$/i';
	static $pwExp			= '/^[a-zÀ-ÿ0-9!@#$&*()_+]{8,20}$/i';
	static $emailExp		= '/^[\w]+(\.[\w]+)*@([\w]+\.)+[a-z]{2,7}$/i';
	
	static $emailSubjectExp	= '/^[.]{1,50}$/i';
	static $emailMessageExp	= '/^[.]{1,10000}$/i';
	
	public static function validateFirstName($value)
	{
		return preg_match(self::$firstNameExp, $value);	
	}
	
	public static function validateLastName($value)
	{
		return preg_match(self::$lastNameExp, $value);	
	}
	
	public static function validateUsername($value)
	{
		return preg_match(self::$usernameExp, $value);	
	}
	
	public static function validatePassword($value)
	{
		return preg_match(self::$pwExp, $value);	
	}
	
	public static function validateEmail($value)
	{
		return preg_match(self::$emailExp, $value);	
	}
	
	public static function validateEmailSubject($value)
	{
		return preg_match(self::$emailSubjectExp, $value);	
	}
	
	public static function validateEmailMessage($value)
	{
		return preg_match(self::$emailMessageExp, $value);	
	}
	
	public static function filterText($text)
	{
		return htmlentities($text);
	}
	
	//getfunktioner
	public static function getFirstNameExp()
	{
		return self::$firstNameExp;
	}
	
	public static function getLastNameExp()
	{
		return self::$lastNameExp;
	}
	
	public static function getUsernameExp()
	{
		return self::$usernameExp;
	}
	
	public static function getPasswordExp()
	{
		return self::$pwExp;
	}
	
	public static function getEmailExp()
	{
		return self::$emailExp;
	}
	
	public static function getEmailSubjectExp()
	{
		return self::$emailSubjectExp;
	}
	
	public static function getEmailMessageExp()
	{
		return self::$emailMessageExp;
	}
}